
var testData2 = [
		{
			storeId:'00001',
			storeName:'店铺1',
			residual:'300.00',
			phone:'0371-88997777',
			address:'xxxxxxx地址',
		},
		{
			storeId:'00002',
			storeName:'店铺2',
			residual:'400.00',
			phone:'0371-88997777',
			address:'xxxxxxx地址2',
		},
		
	];

function storeList(testData2){
	
	$("#storeTable").setTemplateElement("storeTemplate");
	$("#storeTable").processTemplate(testData2);	
	console.log(testData2);
	

	$.each((testData2), function(index,val) {
		 storesId = val.storeId;	
		$("#storeTr tr").on('click',function(){
			storeDetail(testData);
						
			 $("#detail").append(str);
			window.location.href='main/storeDetail.html';
		    
		})
		
		
	});

	
}
storeList(testData2);
var str="";
function storeDetail(testData){
    $.each(testData, function(index,valdata) {
    	console.log(valdata)
    	if(storesId==valdata.storeId){
      str ="<header class='storeHeader' ><a href='javascript:' onclick='history.back(); '><i class='fa fa-chevron-left'> 返回</i></a>"+
    		"<p class='title'>"+valdata.storeName+"</p></header>";
			
    	}
    });


}

